home *** CD-ROM | disk | FTP | other *** search
/ Euroscene 2 / Euroscene 2.iso / USEFUL / DeliTracker130 / Developer / Developer.run / Examples / ST26.s < prev    next >
Encoding:
Text File  |  1992-09-23  |  12.0 KB  |  645 lines

  1.  
  2.     incdir    "Includes:"
  3.     include    "misc/DeliPlayer.i"
  4.  
  5. ;
  6. ;
  7.     SECTION Player,Code
  8. ;
  9. ;
  10.  
  11.     PLAYERHEADER PlayerTagArray
  12.  
  13.     dc.b '$VER: SoundTracker 2.6 player module V1.0 (03 Sep 92)',0
  14.     even
  15.  
  16. PlayerTagArray
  17.     dc.l    DTP_PlayerVersion,0
  18.     dc.l    DTP_PlayerName,PName
  19.     dc.l    DTP_Creator,CName
  20.     dc.l    DTP_Check2,Chk
  21.     dc.l    DTP_Interrupt,mt_music
  22.     dc.l    DTP_InitPlayer,InitPlay
  23.     dc.l    DTP_EndPlayer,EndPlay
  24.     dc.l    DTP_InitSound,InitSnd
  25.     dc.l    DTP_EndSound,EndSnd
  26.     dc.l    TAG_DONE
  27.  
  28. *-----------------------------------------------------------------------*
  29. ;
  30. ; Player/Creatorname und lokale Daten
  31.  
  32. PName        dc.b 'SoundTracker26',0
  33. CName        dc.b 'MnemoTroN,',10
  34.         dc.b 'adapted by Delirium',0
  35.     even
  36. mt_addr        dc.l 0
  37. mt_size        dc.l 0
  38.  
  39. *-----------------------------------------------------------------------*
  40. ;
  41. ; Testet auf ST26-Modul
  42.  
  43. Chk
  44.     move.l    dtg_ChkData(a5),a0
  45.     move.l    $5b8(a0),d0
  46.     subi.l    #'MTN'<<8,d0            ; SoundTracker 2.6 ?
  47.     rts
  48.  
  49. *-----------------------------------------------------------------------*
  50. ;
  51. ; Init Player
  52.  
  53. InitPlay
  54.     moveq    #0,d0
  55.     move.l    dtg_GetListData(a5),a0        ; Function
  56.     jsr    (a0)
  57.     move.l    a0,mt_addr
  58.     move.l    d0,mt_size
  59.  
  60.     move.l    dtg_AudioAlloc(a5),a0        ; Function
  61.     jsr    (a0)                ; returncode is already set !
  62.     rts
  63.  
  64. *-----------------------------------------------------------------------*
  65. ;
  66. ; End Player
  67.  
  68. EndPlay
  69.     move.l    dtg_AudioFree(a5),a0        ; Function
  70.     jsr    (a0)
  71.     rts
  72.  
  73. *-----------------------------------------------------------------------*
  74. ;
  75. ; Init Module
  76.  
  77. InitSnd
  78.     move.l    mt_addr(pc),a0
  79.     bsr    mt_init
  80.     rts
  81.  
  82. *-----------------------------------------------------------------------*
  83. ;
  84. ; Clean up Module
  85.  
  86. EndSnd
  87.     bsr    mt_end
  88.     rts
  89.  
  90. *-----------------------------------------------------------------------*
  91. ;
  92. ; Soundtracker V2.6 - Replay
  93.  
  94. **********************************************
  95. *
  96. * Soundtracker Module-Player
  97. *   for Soundtracker V2.6
  98. *
  99. * SEKA version
  100. * (Devpac: replace 'blk' with 'dcb' (sic!) )
  101. *
  102. * last change: 03-Nov-90 mtn
  103. *
  104. **********************************************
  105. * Note: mt_init has to be called up with the
  106. * address of the module in A0 !!
  107. **********************************************
  108.  
  109. * equates for voice-structure *
  110. mt_cmdperiod=0                ;period
  111. mt_cmd=2                ;instr/cmd
  112. mt_cmdpar=3                ;cmd-parameter
  113. mt_sampleadr=4                ;address of sample
  114. mt_samplelen=8                ;length of sample
  115. mt_samplerep=$a                ;address of repeat-part
  116. mt_samplerepl=$e            ;length of repeat-part
  117. mt_period=$10                ;period to play
  118. mt_volume=$12                ;volume to set
  119. mt_dmabit=$14                ;dmabit for channel
  120. mt_slidedir=$16                ;slide up/down
  121. mt_slidespeed=$17            ;speed of slide
  122. mt_slidedest=$18            ;slide to period x
  123. mt_vibamp=$1a                ;vibrato amplitude
  124. mt_vibcount=$1b                ;counter for vibrato
  125. mt_voicelen=$1c
  126.  
  127. * equates for global player data-structure *
  128. mt_data=0                ;address of module
  129. mt_pattpos=4                ;current position
  130. mt_dmacon=6                ;dma-bits
  131. mt_speedEven=8                ;current speed (even frames)
  132. mt_speedOdd=9                ; -"- (odd frames)
  133. mt_songpos=$a                ;position-counter
  134. mt_counter=$b                ;frame-counter
  135. mt_break=$c                ;flag for pattern-break
  136. mt_datalen=$e
  137.  
  138. mt_init:
  139.     movem.l    d0-d1/a0-a2/a4,-(SP)
  140.     lea    mt_playerdata(PC),a4
  141.     clr.l    mt_data(a4)
  142.     cmp.l    #'MTN'*256,$5b8(a0)
  143.     bne    mt_initerror
  144.     move.l    a0,mt_data(a4)
  145.  
  146.     lea    $3b8(a0),a1
  147.     moveq    #0,d1
  148.     move.w    #$1ff,d0
  149. mt_loop:
  150.     cmp.b    (a1,d0.w),d1
  151.     bhi.s    mt_nothigh
  152.     move.b    (a1,d0.w),d1
  153. mt_nothigh:
  154.     dbf    d0,mt_loop
  155.     addq.b    #1,d1
  156.  
  157.     lea    mt_samplestarts(PC),a1
  158.     lsl.l    #8,d1
  159.     lea    (a0,d1.l),a2
  160.     add.w    #$5bc,a2
  161.     moveq    #$1e,d0
  162. mt_lop3:clr.l    (a2)
  163.     move.l    a2,(a1)+
  164.     moveq    #0,d1
  165.     move.w    42(a0),d1
  166.     add.l    d1,d1
  167.     add.l    d1,a2
  168.     add.w    #$1e,a0
  169.     dbf    d0,mt_lop3
  170.  
  171.     or.b    #2,$bfe001
  172.     move.b    #$06,mt_speedEven(a4)
  173.     move.b    #$06,mt_speedOdd(a4)
  174.     lea    mt_voice1(PC),a0
  175.     move.w    #$0001,mt_dmabit(a0)
  176.     lea    mt_voice2(PC),a0
  177.     move.w    #$0002,mt_dmabit(a0)
  178.     lea    mt_voice3(PC),a0
  179.     move.w    #$0004,mt_dmabit(a0)
  180.     lea    mt_voice4(PC),a0
  181.     move.w    #$0008,mt_dmabit(a0)
  182.     lea    $dff0a8,a0
  183.     clr.w    (a0)
  184.     clr.w    $10(a0)
  185.     clr.w    $20(a0)
  186.     clr.w    $30(a0)
  187.     clr.b    mt_songpos(a4)
  188.     clr.b    mt_counter(a4)
  189.     clr.w    mt_pattpos(a4)
  190. mt_initerror:
  191.     movem.l    (SP)+,d0-d1/a0-a2/a4
  192.     rts
  193.  
  194. mt_end:
  195.     move.l    a0,-(SP)
  196.     lea    $dff0a8,a0
  197.     clr.w    (a0)
  198.     clr.w    $10(a0)
  199.     clr.w    $20(a0)
  200.     clr.w    $30(a0)
  201.     move.w    #$f,$96-$a8(a0)
  202.     move.l    (SP)+,a0
  203.     rts
  204.  
  205. mt_music:
  206.     movem.l    d0-d5/a0-a6,-(SP)
  207.     lea    mt_playerdata(PC),a4
  208.     move.l    mt_data(a4),d0
  209.     beq    mt_playerror
  210.     move.l    d0,a0
  211.     addq.b    #1,mt_counter(a4)
  212.     move.b    mt_counter(a4),d0
  213.     move.w    mt_pattpos(a4),d1
  214.     lsr.w    #2,d1
  215.     and.w    #1,d1
  216.     move.b    mt_speedEven(a4,d1.w),d1
  217.     cmp.b    d1,d0
  218.     blt.s    mt_nonew
  219.     clr.b    mt_counter(a4)
  220.     bra    mt_getnew
  221.  
  222. mt_nonew:
  223.     lea    mt_voice1(PC),a6
  224.     lea    $dff0a0,a5
  225.     bsr    mt_checkcom
  226.     lea    mt_voice2(PC),a6
  227.     lea    $dff0b0,a5
  228.     bsr    mt_checkcom
  229.     lea    mt_voice3(PC),a6
  230.     lea    $dff0c0,a5
  231.     bsr    mt_checkcom
  232.     lea    mt_voice4(PC),a6
  233.     lea    $dff0d0,a5
  234.     bsr    mt_checkcom
  235.     bra    mt_endr
  236.  
  237. mt_arpeggio:
  238.     moveq    #0,d0
  239.     move.b    mt_counter(a4),d0
  240.     divu    #$3,d0
  241.     swap    d0
  242.     tst.w    d0
  243.     beq.s    mt_arp2
  244.     cmp.w    #2,d0
  245.     beq.s    mt_arp1
  246.  
  247.     moveq    #0,d0
  248.     move.b    mt_cmdpar(a6),d0
  249.     lsr.b    #4,d0
  250.     bra.s    mt_arp3
  251. mt_arp1:moveq    #0,d0
  252.     move.b    mt_cmdpar(a6),d0
  253.     and.b    #$f,d0
  254.     bra.s    mt_arp3
  255. mt_arp2:move.w    mt_period(a6),d2
  256.     bra.s    mt_arp4
  257. mt_arp3:add.w    d0,d0
  258.     moveq    #0,d1
  259.     move.w    mt_period(a6),d1
  260.     lea    mt_periods(PC),a0
  261.     moveq    #$24,d3
  262. mt_arploop:
  263.     move.w    (a0,d0.w),d2
  264.     cmp.w    (a0),d1
  265.     bge.s    mt_arp4
  266.     addq.l    #2,a0
  267.     dbf    d3,mt_arploop
  268.     rts
  269. mt_arp4:move.w    d2,6(a5)
  270.     rts
  271.  
  272. mt_getnew:
  273.     clr.w    mt_dmacon(a4)
  274.  
  275.     lea    $dff0a0,a5
  276.     lea    mt_voice1(pc),a6
  277.     moveq    #0,d5
  278.     bsr.s    mt_playvoice
  279.     lea    $dff0b0,a5
  280.     lea    mt_voice2(pc),a6
  281.     moveq    #1,d5
  282.     bsr.s    mt_playvoice
  283.     lea    $dff0c0,a5
  284.     lea    mt_voice3(pc),a6
  285.     moveq    #2,d5
  286.     bsr.s    mt_playvoice
  287.     lea    $dff0d0,a5
  288.     lea    mt_voice4(pc),a6
  289.     moveq    #3,d5
  290.     bsr.s    mt_playvoice
  291.     bra    mt_setdma
  292.  
  293. mt_playvoice:
  294.     move.l    mt_data(a4),a0
  295.     lea    12(a0),a3
  296.     lea    $3b8(a0),a2
  297.     lea    $5bc(a0),a0
  298.  
  299.     moveq    #0,d0
  300.     moveq    #0,d1
  301.     move.b    mt_songpos(a4),d0
  302.     lsl.w    #2,d0
  303.     add.w    d0,a2
  304.     move.b    (a2,d5.w),d1
  305.     lsl.l    #8,d1
  306.     add.w    mt_pattpos(a4),d1
  307.  
  308.     move.l    (a0,d1.l),mt_cmdperiod(a6)
  309.     addq.l    #4,d1
  310.     moveq    #0,d2
  311.     move.b    mt_cmd(a6),d2
  312.     and.b    #$f0,d2
  313.     lsr.b    #4,d2
  314.     move.b    mt_cmdperiod(a6),d0
  315.     and.b    #$f0,d0
  316.     or.b    d0,d2
  317.     tst.b    d2
  318.     beq.s    mt_setregs
  319.     moveq    #0,d3
  320.     lea    mt_samplestarts(PC),a1
  321.     move.l    d2,d4
  322.     subq.l    #$1,d2
  323.     lsl.l    #2,d2
  324.     mulu    #$1e,d4
  325.     move.l    (a1,d2.l),mt_sampleadr(a6)
  326.     move.w    (a3,d4.l),mt_samplelen(a6)
  327.     move.w    $2(a3,d4.l),mt_volume(a6)
  328.     move.w    $4(a3,d4.l),d3
  329.     tst.w    d3
  330.     beq.s    mt_noloop
  331.     move.l    mt_sampleadr(a6),d2
  332.     add.w    d3,d3
  333.     add.l    d3,d2
  334.     move.l    d2,mt_samplerep(a6)
  335.     move.w    $4(a3,d4.l),d0
  336.     add.w    $6(a3,d4.l),d0
  337.     move.w    d0,mt_samplelen(a6)
  338.     move.w    $6(a3,d4.l),mt_samplerepl(a6)
  339.     move.w    mt_volume(a6),8(a5)
  340.     bra.s    mt_setregs
  341. mt_noloop:
  342.     move.l    mt_sampleadr(a6),d2
  343.     add.l    d3,d2
  344.     move.l    d2,mt_samplerep(a6)
  345.     move.w    $6(a3,d4.l),mt_samplerepl(a6)
  346.     move.w    mt_volume(a6),8(a5)
  347. mt_setregs:
  348.     move.w    mt_cmdperiod(a6),d0
  349.     and.w    #$fff,d0
  350.     beq    mt_checkcom2
  351.     move.b    mt_cmd(a6),d0
  352.     and.b    #$f,d0
  353.     cmp.b    #$3,d0
  354.     bne.s    mt_setperiod
  355.     bsr    mt_setmyport
  356.     bra    mt_checkcom2
  357. mt_setperiod:
  358.     move.w    mt_cmdperiod(a6),mt_period(a6)
  359.     and.w    #$fff,mt_period(a6)
  360.     move.w    mt_dmabit(a6),$dff096
  361.     clr.b    mt_vibcount(a6)
  362.  
  363.     move.l    mt_sampleadr(a6),(a5)
  364.     move.w    mt_samplelen(a6),4(a5)
  365.     move.w    mt_period(a6),d0
  366.     and.w    #$fff,d0
  367.     move.w    d0,6(a5)
  368.     move.w    mt_dmabit(a6),d0
  369.     or.w    d0,mt_dmacon(a4)
  370.     bra    mt_checkcom2
  371.  
  372. mt_setdma:
  373.     lea    $dff000,a5
  374.     moveq    #8,d3                ;less than this can cause trouble
  375.     bsr    mt_waitscan
  376.     move.w    mt_dmacon(a4),d0
  377.     or.w    #$8000,d0
  378.     move.w    d0,$96(a5)
  379.     moveq    #1,d3
  380.     bsr    mt_waitscan
  381.     lea    mt_voice4(pc),a6
  382.     move.l    mt_samplerep(a6),$d0(a5)
  383.     move.w    mt_samplerepl(a6),$d4(a5)
  384.     lea    mt_voice3(pc),a6
  385.     move.l    mt_samplerep(a6),$c0(a5)
  386.     move.w    mt_samplerepl(a6),$c4(a5)
  387.     lea    mt_voice2(pc),a6
  388.     move.l    mt_samplerep(a6),$b0(a5)
  389.     move.w    mt_samplerepl(a6),$b4(a5)
  390.     lea    mt_voice1(pc),a6
  391.     move.l    mt_samplerep(a6),$a0(a5)
  392.     move.w    mt_samplerepl(a6),$a4(a5)
  393.  
  394.     addq.w    #4,mt_pattpos(a4)
  395.     cmp.w    #$100,mt_pattpos(a4)
  396.     bne.s    mt_endr
  397. mt_nex:    clr.w    mt_pattpos(a4)
  398.     clr.b    mt_break(a4)
  399.     addq.b    #1,mt_songpos(a4)
  400.     and.b    #$7f,mt_songpos(a4)
  401.     move.b    mt_songpos(a4),d1
  402.     move.l    mt_data(a4),a0
  403.     cmp.b    $3b6(a0),d1
  404.     bne.s    mt_endr
  405.     clr.b    mt_songpos(a4)
  406. mt_endr:tst.b    mt_break(a4)
  407.     bne.s    mt_nex
  408. mt_playerror:
  409.     movem.l    (SP)+,d0-d5/a0-a6
  410.     rts
  411.  
  412. mt_waitscan:
  413.     move.b    6(a5),d1
  414. mt_scanloop:
  415.     cmp.b    6(a5),d1
  416.     beq.s    mt_scanloop
  417.     dbf    d3,mt_waitscan
  418.     rts
  419.  
  420. mt_setmyport:
  421.     move.w    mt_cmdperiod(a6),d2
  422.     and.w    #$fff,d2
  423.     move.w    d2,mt_slidedest(a6)
  424.     move.w    mt_period(a6),d0
  425.     clr.b    mt_slidedir(a6)
  426.     cmp.w    d0,d2
  427.     beq.s    mt_clrport
  428.     bge.s    mt_rt
  429.     move.b    #$1,mt_slidedir(a6)
  430.     rts
  431. mt_clrport:
  432.     clr.w    mt_slidedest(a6)
  433. mt_rt:    rts
  434.  
  435. mt_myport:
  436.     move.b    mt_cmdpar(a6),d0
  437.     beq.s    mt_myslide
  438.     move.b    d0,mt_slidespeed(a6)
  439.     clr.b    mt_cmdpar(a6)
  440. mt_myslide:
  441.     tst.w    mt_slidedest(a6)
  442.     beq.s    mt_rt
  443.     moveq    #0,d0
  444.     move.b    mt_slidespeed(a6),d0
  445.     tst.b    mt_slidedir(a6)
  446.     bne.s    mt_mysub
  447.     add.w    d0,mt_period(a6)
  448.     move.w    mt_slidedest(a6),d0
  449.     cmp.w    mt_period(a6),d0
  450.     bgt.s    mt_myok
  451.     move.w    mt_slidedest(a6),mt_period(a6)
  452.     clr.w    mt_slidedest(a6)
  453. mt_myok:move.w    mt_period(a6),$6(a5)
  454.     rts
  455. mt_mysub:
  456.     sub.w    d0,mt_period(a6)
  457.     move.w    mt_slidedest(a6),d0
  458.     cmp.w    mt_period(a6),d0
  459.     blt.s    mt_myok
  460.     move.w    mt_slidedest(a6),mt_period(a6)
  461.     clr.w    mt_slidedest(a6)
  462.     move.w    mt_period(a6),$6(a5)
  463.     rts
  464.  
  465. mt_vib:    move.b    mt_cmdpar(a6),d0
  466.     beq.s    mt_vi
  467.     move.b    d0,mt_vibamp(a6)
  468.  
  469. mt_vi:    move.b    mt_vibcount(a6),d0
  470.     lea    mt_sin(PC),a0
  471.     lsr.w    #$2,d0
  472.     and.w    #$1f,d0
  473.     moveq    #0,d2
  474.     move.b    (a0,d0.w),d2
  475.     move.b    mt_vibamp(a6),d0
  476.     and.w    #$f,d0
  477.     mulu    d0,d2
  478.     lsr.w    #$6,d2
  479.     move.w    mt_period(a6),d0
  480.     tst.b    mt_vibcount(a6)
  481.     bmi.s    mt_vibmin
  482.     add.w    d2,d0
  483.     bra.s    mt_vib2
  484. mt_vibmin:
  485.     sub.w    d2,d0
  486. mt_vib2:move.w    d0,$6(a5)
  487.     move.b    mt_vibamp(a6),d0
  488.     lsr.w    #$2,d0
  489.     and.w    #$3c,d0
  490.     add.b    d0,mt_vibcount(a6)
  491.     rts
  492.  
  493. mt_nop:    move.w    mt_period(a6),$6(a5)
  494.     rts
  495.  
  496. mt_checkcom:
  497.     move.w    mt_cmd(a6),d0
  498.     and.w    #$fff,d0
  499.     beq.s    mt_nop
  500.     move.b    mt_cmd(a6),d0
  501.     and.b    #$f,d0
  502.     tst.b    d0
  503.     beq    mt_arpeggio
  504.     cmp.b    #$1,d0
  505.     beq.s    mt_portup
  506.     cmp.b    #$2,d0
  507.     beq    mt_portdown
  508.     cmp.b    #$3,d0
  509.     beq    mt_myport
  510.     cmp.b    #$4,d0
  511.     beq    mt_vib
  512.     move.w    mt_period(a6),$6(a5)
  513.     cmp.b    #$a,d0
  514.     beq.s    mt_volslide
  515.     rts
  516.  
  517. mt_volslide:
  518.     moveq    #0,d0
  519.     move.b    mt_cmdpar(a6),d0
  520.     lsr.b    #4,d0
  521.     tst.b    d0
  522.     beq.s    mt_voldown
  523.     add.w    d0,mt_volume(a6)
  524.     cmp.w    #$40,mt_volume(a6)
  525.     bmi.s    mt_vol2
  526.     move.w    #$40,mt_volume(a6)
  527. mt_vol2:move.w    mt_volume(a6),$8(a5)
  528.     rts
  529.  
  530. mt_voldown:
  531.     moveq    #0,d0
  532.     move.b    mt_cmdpar(a6),d0
  533.     and.b    #$f,d0
  534.     sub.w    d0,mt_volume(a6)
  535.     bpl.s    mt_vol3
  536.     clr.w    mt_volume(a6)
  537. mt_vol3:move.w    mt_volume(a6),$8(a5)
  538.     rts
  539.  
  540. mt_portup:
  541.     moveq    #0,d0
  542.     move.b    mt_cmdpar(a6),d0
  543.     sub.w    d0,mt_period(a6)
  544.     move.w    mt_period(a6),d0
  545.     and.w    #$fff,d0
  546.     cmp.w    #$71,d0
  547.     bpl.s    mt_por2
  548.     and.w    #$f000,mt_period(a6)
  549.     or.w    #$71,mt_period(a6)
  550. mt_por2:move.w    mt_period(a6),d0
  551.     and.w    #$fff,d0
  552.     move.w    d0,$6(a5)
  553.     rts
  554.  
  555. mt_portdown:
  556.     clr.w    d0
  557.     move.b    mt_cmdpar(a6),d0
  558.     add.w    d0,mt_period(a6)
  559.     move.w    mt_period(a6),d0
  560.     and.w    #$fff,d0
  561.     cmp.w    #$358,d0
  562.     bmi.s    mt_por3
  563.     and.w    #$f000,mt_period(a6)
  564.     or.w    #$358,mt_period(a6)
  565. mt_por3:move.w    mt_period(a6),d0
  566.     and.w    #$fff,d0
  567.     move.w    d0,$6(a5)
  568.     rts
  569.  
  570. mt_checkcom2:
  571.     move.b    mt_cmd(a6),d0
  572.     and.b    #$f,d0
  573.     cmp.b    #$e,d0
  574.     beq.s    mt_setfilt
  575.     cmp.b    #$d,d0
  576.     beq.s    mt_pattbreak
  577.     cmp.b    #$b,d0
  578.     beq.s    mt_posjmp
  579.     cmp.b    #$c,d0
  580.     beq.s    mt_setvol
  581.     cmp.b    #$f,d0
  582.     beq.s    mt_setspeed
  583.     rts
  584.  
  585. mt_setfilt:
  586.     move.b    mt_cmdpar(a6),d0
  587.     and.b    #1,d0
  588.     add.b    d0,d0
  589.     and.b    #$fd,$bfe001
  590.     or.b    d0,$bfe001
  591.     rts
  592. mt_pattbreak:
  593.     st    mt_break(a4)
  594.     rts
  595. mt_posjmp:
  596.     move.b    mt_cmdpar(a6),d0
  597.     subq.b    #1,d0
  598.     move.b    d0,mt_songpos(a4)
  599.     st    mt_break(a4)
  600.     rts
  601. mt_setvol:
  602.     cmp.b    #$40,mt_cmdpar(a6)
  603.     ble.s    mt_vol4
  604.     move.b    #$40,mt_cmdpar(a6)
  605. mt_vol4:move.b    mt_cmdpar(a6),$8(a5)
  606.     rts
  607. mt_setspeed:
  608.     move.b    mt_cmdpar(a6),d0
  609.     and.w    #$ff,d0
  610.     beq.s    mt_rts2
  611.     move.b    d0,d1
  612.     and.b    #$f0,d1
  613.     beq.s    mt_speed1
  614.     lsr.b    #4,d1
  615.     bra.s    mt_speed3
  616. mt_speed1:
  617.     move.b    d0,d1
  618. mt_speed3:
  619.     and.b    #$f,d0
  620.     bne.s    mt_speed2
  621.     move.b    d1,d0
  622. mt_speed2:
  623.     move.b    d0,mt_speedEven(a4)
  624.     move.b    d1,mt_speedOdd(a4)
  625.     clr.b    mt_counter(a4)
  626. mt_rts2:rts
  627.  
  628. mt_sin:
  629.     dc.b $00,$18,$31,$4a,$61,$78,$8d,$a1,$b4,$c5,$d4,$e0,$eb,$f4,$fa,$fd
  630.     dc.b $ff,$fd,$fa,$f4,$eb,$e0,$d4,$c5,$b4,$a1,$8d,$78,$61,$4a,$31,$18
  631.  
  632. mt_periods:
  633.     dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c,$023a,$021a,$01fc,$01e0
  634.     dc.w $01c5,$01ac,$0194,$017d,$0168,$0153,$0140,$012e,$011d,$010d,$00fe
  635.     dc.w $00f0,$00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097,$008f,$0087
  636.     dc.w $007f,$0078,$0071,$0000,$0000
  637.  
  638. mt_playerdata:    blk.b    mt_datalen,0
  639. mt_samplestarts:blk.l    31,0
  640. mt_voice1:    blk.b    mt_voicelen,0
  641. mt_voice2:    blk.b    mt_voicelen,0
  642. mt_voice3:    blk.b    mt_voicelen,0
  643. mt_voice4:    blk.b    mt_voicelen,0
  644.  
  645.